$(function () {

    var getNewsContent = global.localhost+"Api/New/get_new_content";
    var getMediaContent = global.localhost+"Api/New/get_hydt_content";
    var newsId = getSearch();
    var page = getSearch()[0].split("=")[1];
    newsId = newsId[1].split("=")[1];
    console.log(newsId,page);
    var data = {id:newsId};
    var getUrl = null;
    $('.xinwen').eq(page).css('display','block');
    page == 0?getUrl = getNewsContent:getUrl = getMediaContent;
    sendAjax(getUrl,function (res) {
        console.log(res);
        var day = res.date.split('.')[2];
        var yearMonth = res.date.slice(0,7);
        $('.day').text(day);
        $('.year-month').text(yearMonth);
        var title = res.title;
        $('.xinwen-title').text(title);
        console.log(yearMonth,day);
        var html = res.content;
        // html += '<p class="news-details-title">'+res.title+' <span class="news-details-date">'+res.date+' 发布</span></p>'
        // html += ' <div class="news-content">'+res.content+'</div>';
        $(".xinwen-content").html(html);
    },data)
    var tjUrl = global.localhost + 'Api/New/get_tj';
    sendAjax(tjUrl,function (res) {
        console.log(res);
        var jtxwTj = '<a href="news-details-bak.html?item=0&id='+res.jtxw.id+'">'
        jtxwTj += '<div class="recommend-img" style="background: url('+res.jtxw.hot_img+') no-repeat center center/cover"></div>';
        jtxwTj += '<p class="recommend-title">'+res.jtxw.title+'</p>';
        jtxwTj += '<p class="recommend-sub-content">'+res.jtxw.sub_content+'</p>';
        jtxwTj += '</a>'
        $('.jtyw-new .recommend').html(jtxwTj);
        var mtbdTj = '<a href="news-details-bak.html?item=0&id='+res.hydt.id+'">'
        mtbdTj = '<div class="recommend-img" style="background: url('+res.hydt.hot_img+') no-repeat center center/cover"></div>';
        mtbdTj += '<p class="recommend-title">'+res.hydt.title+'</p>';
        mtbdTj += '<p class="recommend-sub-content">'+res.hydt.sub_content+'</p>';
        mtbdTj +='</a>';
        $('.mtbd-new .recommend').html(mtbdTj)
    })
})
